//--------------------------------------------------------------------------------------------------------------------
// register the function
 var newRegistery1 = new Array("getAssetsAll", "displayAssetsBeingCreated" );
 allJsonsRegistry = allJsonsRegistry.concat(newRegistery1);

//--------------------------------------------------------------------------------------------------------------------
// implement the function
// fills the text area with the current desciption
function displayAssetsBeingCreated(assets) 
{   
    my_assets = document.getElementById('id_assetList');    
    //clean the comments
    if( my_assets.hasChildNodes() ) 
    {
        while ( my_assets.childNodes.length >= 1 )
        {
            my_assets.removeChild( my_assets.firstChild );       
        }
     }
     

    /// add the new comments. Each comment is a comment box wich contains one or 2 boxes.
    /// if we own the comment: a box with the text and a "+" button to hide the comment
    /// if we do not own it: just the text
    for( var i = 0; i <  assets.assets.length; ++i )
    {
        // create the div, one over two will be grey
        var newdiv = document.createElement('div');
        setStyleAttribute(newdiv,'display:table;');
        var str ='<div style="display:table;">';
        str += '  <div class="oneLine" style="color:blue;"><b>_____________________________________________________________________________</b></div>';
        str += '  <div class="oneLine" style="color:blue;"><b>_____________________________________________________________________________</b></div>';
        str += '</div>';
        str += '<form action="/createBetroom/changeNewAsset/" method="post" name="changeNewAsset'+i+'" class="myLeft oneLine">';
        str += '    <div style="display:none">';
        str += '        <input type="hidden" value="'+getCookie('csrftoken')+'" name="csrfmiddlewaretoken">';
        str += '    </div>';
        str += '    <div style="display:table;">';
        str += '        <div class="oneLine">Asset name: '+ assets.assets[i].assetName + '</div>';
        str += '        <div class="oneLine"><input type="checkbox" id="id_check_std'+i+'" name="check_std"> Players will be allowed to says when the event occurs<br></div>';
        str += '        <div class="oneLine">You can change the asset description. Press enter when it is done:</div>';
        str += '        <div class="oneLine"><textarea id="id_asset_desc_text'+i+'" rows="1" cols="90" name="asset_desc_text" onkeypress="ifEnterArg(this, event, submitForm, \'changeNewAsset'+i+'\' );" ></textarea></div>';
        str += '        <div class="oneLine"><input type="hidden" name="nextLoc" value="/createBetroom/step3/" ></input></div>';
        str += '        <div class="oneLine"><input type="hidden" name="asset_name" value="'+ assets.assets[i].assetName + '" ></input></div>';
        str += '    </div>';
        str += '</form>';
        if( assets.beroomStatus == - 1 )
        {
            str += '<form action="/createBetroom/deleteNewAsset/" method="post" name="deleteNewAsset'+i+'" class="myLeft oneLine">';
            str += '    <div style="display:none">';
            str += '        <input type="hidden" value="'+getCookie('csrftoken')+'" name="csrfmiddlewaretoken">';
            str += '    </div>';
            str += '    <div class="oneLine"><input type="hidden" name="nextLoc" value="/createBetroom/step3/" ></input></div>';
            str += '    <div class="oneLine"><input type="hidden" name="asset_name" value="'+ assets.assets[i].assetName + '" ></input></div>';
            str += '    <div class="oneLine"><input type="submit" class="myRoundCorners" value="Delete asset" /></div>';
            str += '</form>';
        }
        newdiv.innerHTML = str;
        // add the div at the end 
        my_assets.appendChild(newdiv);
        // check box
        document.getElementById('id_check_std'+i).checked = assets.assets[i].isStd;
        //description
        document.getElementById('id_asset_desc_text'+i).value = assets.assets[i].assetDescription;
        
    }

};



